using System;
using System.IO;

namespace MM7.MIME.Encoding
{

	public abstract class MIMEEncoding
	{
		internal abstract byte[] Encode(byte[] s);

		internal abstract byte[] Decode(byte[] bytes);

		internal abstract string ContentTransferEncodingString{get;}

		public static MIMEEncoding Base64Encoding
		{
			get
			{
				return new Base64Encoding();
			}
		}

		public static MIMEEncoding QPEncoding
		{
			get
			{
				return new QPEncoding();
			}
		}
	
		public static MIMEEncoding SevenBitEncoding
		{
			get
			{
				return new SevenBitEncoding();
			}
		}
	
		public static MIMEEncoding EightBitEncoding
		{
			get
			{
				return new EightBitEncoding();
			}
		}

		public static MIMEEncoding GetEncoding(string type)
		{
			if (string.Compare(type, "base64") == 0)
			{
				return Base64Encoding;
			}
			else if (string.Compare(type, "quoted-printable") == 0)
			{
				return QPEncoding;
			}
			else if (string.Compare(type, "7bit") == 0)
			{
				return SevenBitEncoding;
			}
			else if (string.Compare(type, "8bit") == 0)
			{
				return EightBitEncoding;
			}
			else
			{
				return EightBitEncoding;
			}
		}
	}
}
